package com.mew.common.rest.login;

import com.zebra.common.ZebraBaseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @Date 2019/8/21 0021
 **/
@Data
@ToString
@NoArgsConstructor
public class LoginGuestRequestMessage extends ZebraBaseMessage<LoginGuestRequestMessage> {

    private Long uid;  //uid
    private String mac;  //mac 地址
    private byte devicesType; //1,手机， 2: "模拟器" ,
    private String ip;  //IP

    //--无需前端传入
    private String serverId;

    @Override
    public void write(ByteBuf byteBuf) {

        writeLong(byteBuf, this.uid);
        writeString(byteBuf, this.mac);
        writeByte(byteBuf, this.devicesType);
        writeString(byteBuf, this.ip);
    }

    @Override
    public LoginGuestRequestMessage read(ByteBuf b) {
        LoginGuestRequestMessage message = new LoginGuestRequestMessage();
        message.uid = readLong(b);
        message.mac = readString(b);
        message.devicesType = readByte(b);
        message.ip = readString(b);
        return message;
    }
}
